<template>
    <div>
        <div class="mui-content">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a class="mui-control-item mui-active" data-wid="tab-top-subpage-1.html">
							推荐
						</a>
						<a class="mui-control-item" href="#item2mobile" data-wid="tab-top-subpage-2.html">
							热点
						</a>
						<a class="mui-control-item" href="#item3mobile" data-wid="tab-top-subpage-3.html">
							北京
						</a>
						<a class="mui-control-item" href="#item4mobile" data-wid="tab-top-subpage-4.html">
							社会
						</a>
						<a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
							娱乐
						</a>
                        <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
							科技
						</a>
                        <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
							新闻
						</a>
                        <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
							娱乐
						</a>
						 <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">
							娱乐
						</a>
					</div>
				</div>
				<!-- 如果请求到了数据 -->
				<!-- <div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item', item.id == 0 ? mui-active : '']"  data-wid="tab-top-subpage-1.html" v-for="item in list" :key=item.id tag="li">
							{{item.title}}
						</a>
			
					</div>
				</div> -->
		</div>
				<!-- 制作图片 -->
				<!-- <ul>
  				<li v-for="item in listimg" :key="item.id">
					  图片请求
    			<img v-lazy="item.img_url">
		

  				</li>
				</ul> -->
			<router-link :to="'/login/images/' + this.li">图片列表</router-link>
    </div>
</template>
<script>
import mui from '../../js/mui.min.js'
import {Toast} from 'Mint-ui'
export default {
    data() {
		return {
			list: [],
			listimg: [],
			li:1
		}
	},
	created() {
		this.show()
		this.getimages(0)
	},
	mounted() {
		// 当组件的dom结构被渲染好放到页面的中后，会立即执行这个钩子函数
		// 如果需要操作元素，最好在mounted里面，因为，这里的DOM元素是最新的
		// 初始化滑动控件
		mui(".mui-scroll-wrapper").scroll({
			deceleration: 0.0005  // flick 减速系数，系数越大滚动速度越慢，滚动距离越小  默认值0.0006
			
		})
	},
	methods: {
		show() {
			this.$http.get('api/gettimgcategroy').then(function(res) {
				if (res.body.meassage == 0) {
					res.body.message.unshift({title: "全部",id:0})
					this.list = res.body.message
				}else {
					Toast('获取信息失败')
				}
			},function() {
				Toast('头部swipe信息获取失败')
			})
		},
		getimages(catedid) {
			this.$http.get('api.getimages/' + catedid).then(function(res) {
				if (res.body.status == 0) {
					this.listimg = res.body.message
				}else {
					Tosat('图片请求失败')
				}
			},function() {
				Toast({
					message: '图片获取也失败',
					position: 'bottom',
					duration: 3000
				})
			})
		}

	},
}
</script>
<style lang="scss" scoped>
    * {
        touch-action: pan-y;
    }
	img[lazy=loading] {
  width: 40px;
  height: 300px;
  margin: auto;
	}
</style>